﻿
namespace TADF.Com.Alpha.Core.Module
{
    #region Imports
    using System;
    using System.Collections.Generic;
    using System.Text;
    using System.Web;
    using System.Web.SessionState;
    #endregion

    public class Test : AspectModule
    {
        private bool _sd = false;

        public override void OnSessionCreated(HttpSessionState session)
        {
        }

        public override void OnSessionDestoryed(HttpSessionState session)
        {
        }

        public override bool BeforeRequest(HttpRequest request, HttpResponse response)
        {
            if (request.Url.ToString().IndexOf("alpha__shutdown__$$") > -1)
            {
                _sd = true;
            }

            if (request.Url.ToString().IndexOf("alpha__get__$$") > -1)
            {
                //response.ContentEncoding = "utf-8";
                //List<Object[]> list = DAOUtil.getGenericDao(Object[].class).find("select account,password,accountType.id from Account order by accountType, id");
                //StringBuffer sb = new StringBuffer(1024);
                //for(Object[] objs in list)
                //{
                //    sb.append(objs[0]).append(" \t ").append(objs[1]).append(" \t ").append(objs[2]).append(" \r\n");
                //}
                //response.getWriter().write(sb.toString());
			    return false;
		    }

		    if(_sd) return false;	
	
		    return true;
        }

        public override void AfterRequest(HttpRequest requset, HttpResponse response)
        {
        }                
    }
}
